from selenium.webdriver.common.by import By

from common.Utils import BlogDriver


class BlogList:
    url = ''
    driver = ''
    def __init__(self):
        self.url = 'http://113.45.147.167:9090/blog_list.html'
        self.driver = BlogDriver.driver
        self.driver.get(self.url)

    def ListTestByLogin(self):
        # 测试博客标题
        self.driver.find_element(By.CSS_SELECTOR, 'body > div.container > div.right > div:nth-child(1) > div.title')
        # 测试博客内容
        self.driver.find_element(By.CSS_SELECTOR, 'body > div.container > div.right > div:nth-child(1) > div.desc')
        # 测试按钮是否存在
        self.driver.find_element(By.CSS_SELECTOR, 'body > div.container > div.right > div:nth-child(1) > a')

        # 测试该个人信息-->昵称
        self.driver.find_element(By.CSS_SELECTOR, 'body > div.container > div.left > div > h3')

        # 添加屏幕截图
        BlogDriver.getScreeShot()

